function lstinf$(a$,b$,c$)
  adra=1:adrb=1:blngt=len(b$):d$=""
  while adrb<=blngt
    if mid$ (a$,adra,1)=mid$ (b$,adrb,1) then:adrb+=1:end if
    adra=adra+1
    end while
  while mid$(a$,adra,1)<>left$(c$,1)
    d$=d$+mid$(a$,adra,1):adra=adra+1
    end while
  lstinf$=d$
  end function
function vldc(a$)
  t0$="!"+a$+".0.0.0."
  t1$=lstinf$(t0$,"!",".")
  t2$=lstinf$(t0$,".",".")
  t3=10^(len(t2$))
  vldc=val(t1$)+(val(t2$)/t3)
  end function
finp$="_.csv"
if argc>2 then:finp$=argv(2):end if
open finp$ for input as #1
mxchn=3
if argc>3 then:mxchn=val(argv(3)):end if
rfst1$=",,,":for i=1 to mxchn:rfst1$+=",,,":next
vblqv=1:vblcv=vblqv:lct=0
while eof(1)=0
  file input #1,txrd$
  setcaption("a:"+str$(lct)):lct+=1
  txrd$=","+txrd$
  for i=1 to mxchn:txrd$+=",,,":next
  txou$=""
  vblqs$=lstinf$(txrd$,left$(rfst1$,1),",")
  if vblqs$<>"" then: vblqv=vldc(vblqs$):end if
  if vblcv<>vblqv then:vblcv=vblqv:end if
  for cchn=0 to mxchn-1
    cchnfq$=lstinf$(txrd$,left$(rfst1$,2+(cchn*2)),",")
    cchnvl$=lstinf$(txrd$,left$(rfst1$,3+(cchn*2)),",")
    cchnfq$=trim$(cchnfq$)
    cchnvl$=trim$(cchnvl$)
    cchnfqo$="":cchnvlo$=""
    if cchnfq$="" then:cchnfqo$="[nul:0]":end if
    if cchnvl$="" then:cchnvlo$="[nul:1]":end if
    if left$(cchnfq$,1)="(" then:
      cchnfq$+="#"
      tmv1=val(lstinf$(cchnfq$,"(","/"))
      tmv2=val(lstinf$(cchnfq$,"/",")"))
      tmv3=val(lstinf$(cchnfq$,"+","#"))
      tmvf=(tmv1/tmv2)+tmv3
      cchnfqo$="[f"+right$(str$(100+cchn),2)+":"+str$(tmvf)+"]"
      end if
    if lcase$(left$(cchnfq$,1))="h" then:
      cchnfq2$=right$(cchnfq$,len(cchnfq$)-1)
      freqhz1=vldc(cchnfq2$)
      tmvf=(log(freqhz1*.0611561)/log(2))
      cchnfqo$="[f"+right$(str$(100+cchn),2)+":"+str$(tmvf)+"]"
      end if
    if asc(lcase$(left$(cchnfq$,1)))>=asc("a") and asc(lcase$(left$(cchnfq$,1)))<=asc("g") then:
      vq1=asc(lcase$(left$(cchnfq$,1)))-97
      tmv1=(((vq1+5)mod 7)*2)-int(((vq1+5)mod 7)/3)+int(((vq1+5)mod 7)/6)
      tmv1+=int(((asc(mid$(cchnfq$,2,1)))mod 4)/2)
      tmv3=val(mid$(cchnfq$,3,1))
      cchnfq2$=cchnfq$+"+0+0+"
      tmv5=vldc(lstinf$(cchnfq2$,"+","+"))
      tmvf=((tmv1+tmv5)/12)+tmv3
      cchnfqo$="[f"+right$(str$(100+cchn),2)+":"+str$(tmvf)+"]"
      end if
    if cchnvl$<>"" then:
      tmv5=vldc(cchnvl$)
      cchnvlo$="[v"+right$(str$(100+cchn),2)+":"+str$(tmv5)+"]"
      end if
    txou$+=cchnfqo$
    txou$+=cchnvlo$
    next
  txou$+="[wvb:"+str$(vblcv)+"]"
  print txou$
  wend
close #1

